package com.aaa.day1105.first.demo;

import java.util.Arrays;
import java.util.stream.Collectors;


/**
 * @Description:
 * @author:LiWei
 * @date:2022年11月05日16:14
 */
public class Test1 {
    public static void main(String[] args) {
        Integer [] arr={27,334,46,99,66,20,456};

        Long collect = Arrays.stream(arr).collect(Collectors.counting());
        System.out.println(collect);

        Double collect1 = Arrays.stream(arr).collect(Collectors.averagingInt(item -> item));
        System.out.println(collect1);


        //Optional<Integer> reduce = Arrays.stream(arr).reduce((t1, t2) -> t1+=t2);
        //System.out.println(reduce.get());
    }
}
